package base;

import java.net.MalformedURLException;
import java.net.URL;

import org.openqa.selenium.Dimension;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;

import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;

public class BaseDriver {
	protected AndroidDriver<AndroidElement> driver=null;
	Dimension dimension;
	String urlStr="http://127.0.0.1:4723/wd/hub";
	@BeforeClass
	public void init() throws MalformedURLException {
		DesiredCapabilities cap=new DesiredCapabilities();
		cap.setCapability("platformName", "Android");
		cap.setCapability("deviceName", "127.0.0.1:62001");
		cap.setCapability("appPackage", "com.cnezsoft.xxm");
		cap.setCapability("appActivity", ".MainActivity");
		URL url=new URL(urlStr);
		driver=new AndroidDriver<AndroidElement>(url,cap);
		dimension=driver.manage().window().getSize();
	}
//	@AfterClass
//	public void quit() { 
//		if(driver!=null) {
//			driver.quit();
//		}
//	}
}
